package com.breaktian.assemble.socket;

import com.breaktian.assemble.socket.callback.ListenTcpCallBack;
import com.breaktian.assemble.socket.tcp.TcpServerSocketTwo;
import com.breaktian.assemble.socket.tcp.TcpSocketTwo;



public class Test {
		
	
	public static void main(String[] args) {
		TcpServerSocketTwo serverSocket2 = new TcpServerSocketTwo(8080);
		serverSocket2.listen(new ListenTcpCallBack() {
			
			@Override
			public void onRecvUTFNoBack(String s) {
				System.out.println("server收到："+s);
			}
			
			@Override
			public String onRecvUTF(String s) {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public void onRecvData(byte[] data) {
				// TODO Auto-generated method stub
				
			}
		});
		
		
		TcpSocketTwo socket = new TcpSocketTwo();
		socket.connect("127.0.0.1", 8080);
		socket.send("11111");
		socket.listen(new ListenTcpCallBack() {
			
			@Override
			public void onRecvUTFNoBack(String s) {
				System.out.println("client收到："+s);
			}
			
			@Override
			public String onRecvUTF(String s) {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public void onRecvData(byte[] data) {
				// TODO Auto-generated method stub
				
			}
		});
		serverSocket2.send("我是服务器发送的");
		
	}
	
	
}
